﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InstrumentCheck.Module;
using InstrumentCheck.DAL;

namespace InstrumentCheck.BLL
{
    public class Maintain_bll
    {
        private static Maintain_dal mainTain_dal = new Maintain_dal();

        public static List<Item> GetItemList(string strFasNO)
        {
            return mainTain_dal.GetItemList_dal(strFasNO);
        }

        public static List<Item> GetItemListByCondition(string strFasNO, string strItemName, string strDeptNO)
        {
            return mainTain_dal.GetItemListByCondition_dal(strFasNO, strItemName, strDeptNO);
        }

        public static List<Attach> GetAttachListbyFasNO(string strFasNO, AttachmentType attachType)
        {
            List<Attach> result = null;
            List<Attach> attachList = mainTain_dal.GetActiveAttachListbyFasNO(strFasNO);
            if (attachList != null)
                result = attachList.Where(a => a.Type == attachType).ToList<Attach>();
            return result;
        }

        public static List<ApplyForm> GeAllFormListbyFasNO(string strFasNO)
        {
            return mainTain_dal.GeAllFormListbyFasNO_dal(strFasNO);
        }

        public static void SaveItem(Item item)
        {
            mainTain_dal.SaveItem_dal(item);
        }

        public static void UpdateItem(Item item, string OldFasNO)
        {
            mainTain_dal.UpdateItem_dal(item, OldFasNO);
        }
    }
}
